<?php
include_once('common/header.php');
if($AppUI->id <= 0 || (isset($_SESSION['education']) && (($_SESSION['education']&1<<2) == 0))) {
	$this->_redirect(HOST_BACKEND);
}
$intEcoursId 	= $objRequest->getParam('ecoursid', 0);
$objEcourse		= new Ecourse();
$objEducation	= new Education();
$objCommon		= new Ecore_Common();
$objCategory	= new Category();
$arrRow			= $objEcourse->get($intEcoursId);
$intCategoryId	= isset($_SESSION['ECOURSE_POST']['pcategoryid']) ? $_SESSION['ECOURSE_POST']['pcategoryid'] : $arrRow['categoryid'];
$intProvince	= isset($_SESSION['ECOURSE_POST']['pprovince']) ? $_SESSION['ECOURSE_POST']['pprovince'] : $arrRow['province'];
$this->view->row			= $arrRow;
$this->view->arrProvince	= $objCommon->getProvince();
$this->view->arrCategory	= $objCategory->getParent(EDUCATION_TYPE);
$this->view->arrEducate		= $objEducation->getAllByCate($intCategoryId, $intProvince);
$this->view->arrUnit		= $arrUnit;
$this->view->arrAdv			= $arrAdv;
$this->view->back			= isset($_SESSION[SESSION_BACKURL]) ? $_SESSION[SESSION_BACKURL] : HOST_BACKEND;
if(isset($_SESSION['ECOURSE_POST']['ptbfeature'])) {
	$strJson	= str_replace('\\','',$_SESSION['ECOURSE_POST']['ptbfeature']);	
	$this->view->arrFeatures = json_decode($strJson);
}elseif(isset($arrRow['features'])) {
	$strJson	= str_replace('\\','',$arrRow['features']);
	$this->view->arrFeatures = json_decode($strJson);
}